import Vue from 'vue'
import './plugins/axios'
import App from './App.vue'
import router from './router'
import store from './store'
import 'lib-flexible/flexible'
// 导入vant组件  四个写成一个  用逗号隔开
import { NavBar,
  Form,
  Field,
  Button,
  Tabbar, 
  TabbarItem,
  Search,
  Swipe,
   SwipeItem ,
   Icon,
   Stepper,
   GoodsAction,
    GoodsActionIcon, 
    GoodsActionButton,
    Checkbox, 
    CheckboxGroup,
    Empty,
    AddressList,
    AddressEdit
} from 'vant'


Vue.use(AddressEdit);





Vue.use(AddressList);



Vue.use(Checkbox);
Vue.use(Empty);
Vue.use(CheckboxGroup);


Vue.use(GoodsAction);
Vue.use(GoodsActionButton);
Vue.use(GoodsActionIcon);


Vue.use(Stepper);



Vue.use(Icon);
Vue.use(Swipe);
Vue.use(SwipeItem);
Vue.use(Search);

import { Toast } from 'vant';
import { Popup } from 'vant';
Vue.use(Popup);

Vue.use(Toast);


Vue.use(Tabbar);
Vue.use(TabbarItem);

Vue.use(Button);

Vue.use(Form);
Vue.use(Field);



// 全局注册
Vue.use(NavBar)

// 拦截器


// 添加请求拦截器
axios.interceptors.request.use(function (config) {
  // 在发送请求之前做些什么
  Toast.loading({
    message: '加载中...',
    forbidClick: true,
  });
  return config;
}, function (error) {
  Toast.clear();
  // 对请求错误做些什么
  return Promise.reject(error);
});


// 添加响应拦截器
axios.interceptors.response.use(function (response) {
  // 对响应数据做点什么
  Toast.clear();
  return response;
}, function (error) {
  Toast.clear();
  // 对响应错误做点什么
  return Promise.reject(error);
});







Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
